<?php
/**
 * Celebrio FileSystem module
 *
 * @copyright  Copyright (c) 2011 Celebrio Software
 * @package    Celebrio
 * @subpackage FileSystem
 */
namespace Celebrio\FileSystem;

use Nette\IO;
use Nette\Object;


/**
 * Albireo class simplyfing work with a file usign Nette\IO\SafeStream
 * The write/read actions here are always atomic
 *
 * @author     Albireo Solutions
 * @package    Kernel
 * @deprecated
 */
class SafeFile extends Object {

    /**
     * gets File object for atomic safe work
     * @param string $file_url file url
     * @param string $file_mode IO mode (r|r+|w|w+|a|a+|x|x+) - add 'b' for Windows
     */
    public function __construct ( $file_url, $file_mode = "r" ) {
	SafeStream::register(); // register safe:// protocol
	return new File("safe://$file_url",$file_mode);
    }
    // TODO: otestovat kvuli close file

}